<template>
  <div class="">
         <el-card class="box-card">
<el-form :model="requestParameters" ref="requestParameters">
          <el-form-item prop="title">
            <el-input
              @keyup.enter="handleFilter"
              style="width: 200px;"
              :placeholder="$t('table.search')"
              class="filter-item"
              v-model="requestParameters.title"
            ></el-input>
            <el-button
              class="filter-item"
              size="small"
              type="primary"
              icon="el-icon-search"
              @click="handleFilter"
            >{{$t('table.search')}}</el-button>
            <el-button class="filter-item" size="small" type="primary" @click="resetForm">重置</el-button>
          </el-form-item>
          <el-button
            class="filter-item fr"
            size="small"
            style="margin-left: 10px;"
            @click="handleCreate"
            type="primary"
            icon="el-icon-edit"
          >1234</el-button>
        </el-form>
            <div class="pagination">
            <div class="pages">
            <el-pagination
              background
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="Number(requestParameters.page)"
              :total="Number(total)"
              :page-size="Number(requestParameters.pagesize)"
              :page-sizes="[10,20,30, 50]"
              layout="sizes, prev, pager, next, jumper"
            ></el-pagination>
          </div>
        </div>
         </el-card>
  </div>
</template>

<script>
export default {
  name: '',
  components: {

  },
  data () {
    return {
      requestParameters: {
        page: 1,
        pagesize: 10,
        title: this.title
      },
      total: null,
      listLoading: false
    }
  },
  created () {

  },
  methods: {
    // 搜索信息
    handleFilter () {
      this.requestParameters.page = 1
      this.getList(this.requestParameters)
    },
    // 重置
    resetForm () {
      this.$refs.requestParameters.resetFields()
    },
    // 新增用户
    handleCreate () {
      this.text = '创建'
      // this.$refs.editPermission.handleResetForm()
      // this.$refs.editPermission.dialogFormV()
    },

    // 获取列表数据
    getList (params) {
      this.listLoading = true
      // list(this.requestParameters)
      //   .then(data => {
      //     this.dataList = data.data.list
      //     this.total = data.data.counts
      //     this.alertText = `共 ${this.total} 条记录`
      //     this.listLoading = false
      //   })
      //   .catch(e => {
      //     this.$message.e('错了哦，这是一条错误消息')
      //   })
    },

    // 每页显示信息条数
    handleSizeChange (val) {
      this.requestParameters.pagesize = val
      if (this.requestParameters.page === 1) {
        this.getList(this.requestParameters)
      }
    },
    // 进入某一页
    handleCurrentChange (val) {
      this.requestParameters.page = val
      this.getList()
    }
  }
}
</script>

<style lang="less" scoped>

</style>
